#include<iostream>
#include<unistd.h>
#include<signal.h>
using namespace std;

void myhander(int signo)
{
    cout<<"get a signal, nummber: "<<signo<<endl;
    alarm(5);
}

int main()
{
    signal(SIGALRM, myhander);
    int n = alarm(5);
    while (true)
    {
        cout<<"process is running..."<<endl;
        sleep(1);
    }

    return 0;
}